home *** CD-ROM | disk | FTP | other *** search
/ 17 Bit Software 6: Level 6 / 17 Bit - Level 6 (1998)(Epic Marketing)[!].iso / quartz / q0542.dms / q0542.adf / Uedit2 / Documentation / UEK.DOC < prev    next >
Text File  |  1978-03-02  |  30KB  |  830 lines

  1. -----------------------------------------------------------------------------
  2. |                              UEK.DOC                                        |
  3. |         Placed in the public domain July 92 Rick Stiles.                    |
  4. -----------------------------------------------------------------------------
  5.                          
  6.                          Special UEK functions
  7.  
  8.  
  9. The peek() and poke() functions enable you to peek at any memory address and
  10. poke a value into it.
  11.  
  12. getAddress() gets the address of internal Uedit variables which are in the
  13. table below.  For array or structure variables, you can add an offset to the
  14. address that getAddress() returns to you and access a structure member or
  15. index into an array.  Most of the variables listed are "dangerous" to change
  16. with poke() and should only be used for READ-ONLY purposes.  See the warnings
  17. below.
  18.  
  19. peek() gets the 1, 2, or 4 byte integer value at the given address.
  20.  
  21. poke() stores the 1, 2, or 4 byte integer value at the given address.
  22.  
  23. The Type argument indicates which kind of integer value to store:  1 byte, 2
  24. byte, or 4 byte.
  25.  
  26. CL Functions:
  27.  
  28.     getAddress(variable,addr) - gets Variable address; returns FALSE if
  29.                                 variable number is not in Variable list.
  30.  
  31.     peek(addr,val,type)   - gets val from address, always returns TRUE.
  32.                             (See Type argument below.)
  33.  
  34.     poke(addr,val,type)   - pokes val into address, always returns TRUE.
  35.                             (See Type argument below.)
  36.  
  37. Arguments:
  38.  
  39.     variable:  see Variables list below.
  40.     addr:  memory address
  41.     val:   integer value (byte, short, or long integer)
  42.     type:  1=byte, 2=short, 4=long
  43.            (Note:  Type MUST correspond to the type of the variable you are
  44.            accessing in the list below, if you are accessing one of the
  45.            listed Variables.  Using the wrong type in poke() would corrupt
  46.            memory.)
  47.  
  48.  
  49.                  
  50.                  ***** How to use these functions *****
  51.  
  52.  
  53. When you first start using these functions, you had better be prepared for a
  54. crash or lockup and having to reboot.  These functions work nicely, but the
  55. first time you try them out you are liable to make mistakes that cause memory
  56. corruption or are liable to change a variable that should not be changed.
  57. Only poke() can cause trouble, however.  getAddress() and peek() are
  58. "passive" and harmless.
  59.  
  60. There is a good way to use these functions and a way I hope you won't use
  61. them.  If you waste hours fooling with them, you are defeating the purpose of
  62. Uedit.  Uedit is supposed to be Productive and Useful.  It is supposed to
  63. save you Time and make your work Easy.  It is not supposed to be a Job in
  64. itself.
  65.  
  66. Do not peek and poke around needlessly, wasting time on these functions.  Use
  67. them only in crisp, one-shot cases, where they enable you to write useful
  68. commands for which the regular CL lacks a required ingredient or access.
  69.  
  70. For example, suppose you need to correlate mouse X-Y position with column and
  71. line in the window.  Using getAddress() and peek() you can get all the
  72. information you need.  You can get the addresses of vertPixels, horPixels,
  73. charHeight, charWidth, and lineHeight - but you won't need all of these.
  74. Using peek() on the addresses for these, you can get the values of
  75. charHeight, and so on.  The value in lineHeight[0] is the base of the message
  76. line, which is the beginning of the text area of the window.  Then you can
  77. compute the line and column corresponding to the mouseX-Y.  But as
  78. lineHeight[] contains the precomputed vertical pixel positions of lines, you
  79. shouldn't need charHeight or vertPixels.
  80.  
  81. getAddress() and peek() can accomplish the same thing as a great many of the
  82. CL functions, such as setEol(), getFlag(), flipFlag(), getLocal(),
  83. setLocal(), etc.  Using address offsets into curBuf's structure or a buffer's
  84. in the buf[] array, you can get the local lineLength, pageLines, and so on,
  85. just as you can with getLocal().  You can do that with any buffer in the
  86. buf[] array, but first be sure to check the buf[n] pointer to see if it is
  87. NULL.  A NULL buf[n] pointer means that the buffer does not exist.
  88.  
  89. getAddress() and peek() are always safe to use.  Using them, you can discover
  90. the values and status of things that the regular CL doesn't give you access
  91. to.  For example, you can tell whether a buffer exists or not, whereas
  92. isEmpty() returns True if it exists but is empty or doesn't exist.
  93.  
  94. Poke() is "dangerous" to use in the majority of cases and would corrupt
  95. memory and cause Uedit to malfunction or crash or lock up.
  96.  
  97.                       *********  WARNINGS ********
  98.  
  99.     *** The variables in the list below should be used ONLY for READ-ONLY
  100.         purposes.
  101.  
  102.     *** If you use poke(), it is entirely at your own risk.  Before
  103.         experimenting with poke(), save your file changes first!  Otherwise
  104.         you may lose hours of work that hasn't been saved.
  105.     
  106.     *** Even variables that seem innocuous such as noDisplay may cause a
  107.         CRASH if you change their value.  (noDisplay is especially dangerous,
  108.         but so are execLearn and most variables in the list.)
  109.  
  110.     *** The variables marked (*) are "possibly" safe to change with poke():
  111.             * If you poke a value in the Allowed Range for that variable.
  112.             * If you poke ONLY 1 byte for char/uchar variables, 2 bytes for
  113.                 short variables, and 4 bytes for long or address variables.
  114.             * If you do it at Your Own Risk.
  115.  
  116.     *** I could easily have made mistakes in marking variables as safe or
  117.         unsafe.  I merely went by my recollection of how the program uses
  118.         them.  I did not trace and try changing each one to make sure.  I did
  119.         try to err on the side of caution in marking them, however.
  120.     
  121.  
  122.                              Variable List
  123.  
  124. Addresses:  With getAddress() you are getting the ADDRESS of the variables
  125. below, NOT the value of them.  Note that this is just as true for pointer
  126. (address) variables.  You can only get the value using peek().  For instance,
  127. nStack is the base pointer of the number stack.  If you use getAddress() to
  128. get the address of nStack, then in order to get the address that nStack is
  129. pointing to (i.e., the value of nStack) you must use peek().
  130.  
  131. Variable Name             Type (Purpose)
  132. -------- ----             -------
  133. 0 (*)    eol             --uchar (current end of line char)--
  134. 1 (*)    mouseX          --short (last mouseX)--
  135. 2 (*)    mouseY          --short (last mouseY)--
  136. 3 (R)    reportMouse     --short (trackMouse flag)--
  137. 4 (R)    mouseDown        --short (mouseDown flag)--
  138. 5 (*)    inputChar        --short (last inputChar, 0 if has cmd)--
  139. 6 (*)    macroNum        --short (last macroNum)--
  140. 7 (*)    gChar            --short (last inputChar, not 0 even if has cmd)--
  141. 8 (*)    showTitle        --short (if nonzero refresh title bar in next pause)--
  142. 9 (R)    depth            --short (screen depth, 1 or 2 bitplanes)--
  143.  
  144. 10 (R)  maxLineChars    --short (max chars per line)--
  145. 11 (R)  charHeight      --short (char pixel height)--
  146. 12 (R)  charWidth        --short (char pixel width)--
  147. 13 (R)  vertPixels      --short (vert screen pixels, use X2 for lace)--
  148. 14 (R)  horPixels        --short (hor window pixels )--
  149. 15 (R)  maxLines        --short (max text lines in window)--
  150. 16 (R)  vscrollamt      --short (vert scroll amt outstanding)--
  151. 17 (R)  hscrollamt      --short (hor scroll amt outstanding)--
  152. 18 (*)  globalFlags     --ulong (global flags picked up by new buffers)--
  153. 19 (R)  primitive        --short (PM flag, 0=no, 1=startup compile, 2=PM)--
  154.  
  155. 20 (*)  displayFlag     --short (display flag bits)--
  156. 21 (R)  curSplit        --short (current split # in split window arrays)
  157. 22 (R)  noDisplay        --short (on when hideDisplay being used)--
  158. 23 (*)  toTiny          --short (goto tiny window next pause flag)--
  159. 24 (*)  stopPause        --short (abort flag)--
  160. 25 (R)  menusUp         --short (menus are up flag)--
  161. 26 (R)  warpUp          --short (warptext is up flag)--
  162. 27 (R)  execLearn        --short (am running learned seq flag)--
  163. 28 (*)  stopSave        --short (abort save next chance flag)--
  164. 29 (R)  saves            --short (# file saves outstanding)--
  165.  
  166. 30 (R)  prtOpen         --short (printer port open flag)--
  167. 31 (R)  prints          --short (# prints outstanding)--
  168. 32 (*)  UNUSED          -- --
  169. 33 (*)  menuInset        --short (% (0-100) offset of submenus)--
  170. 34 (D)  curLearn        --short (index in running/learning learned seq)--
  171. 35 (D)  curMsgIn        --short (# of current input in msgQ array)--
  172. 36 (D)  curMsgOut        --short (# of current output in msgQ array)--
  173. 37 (R)  curBuf          --struct CB *curBuf (current buffer)--
  174. 38 (R)  rp              --struct RastPort *rp--
  175. 39 (R)  uport            --struct MsgPort *uport (input port)--
  176.  
  177. 40 (R)  edScreen        --struct Screen *edScreen--
  178. 41 (R)  edWindow        --struct Window *edWindow--
  179. 42 (R)  vp              --struct ViewPort *vp--
  180. 43 (R)  ffont            --struct TextFont *ffont--
  181. 44 (R)  nStack          --struct ST *nStack(number stack)--
  182. 45 (R)  bStack          --struct ST *bStack(buffer stack)--
  183. 46 (R)  sStack          --struct ST *sStack(file-save stack)--
  184. 47 (D)  cmdTable        --uchar *cmdTable[MAXMACROS] (macro table)--
  185. 48 (D)  cmdLens         --short cmdLens[MAXMACROS] (macro lengths)--
  186. 49 (D)  msgQ            --struct msgQueue msgQ[MAXMSGS+1](raw inputs)--
  187.  
  188. 50 (D)  learnQ          --struct msgQueue learnQ[MAXLEARN+1](learn inputs)--
  189. 51 (*)  tabTables        --uchar tabTables[MAXTABTABLES][MAXTABS + 1]--
  190. 52 (D)  printByte        --long printByte[MAXPRINTS](current byte)--
  191. 53 (R)  printLen        --long printLen[MAXPRINTS](size of print)--
  192. 54 (R)  printBuf        --uchar *printBuf[MAXPRINTS](buffer)--
  193. 55 (R)  printChoice     --short printChoice[MAXPRINTS](prefPrint this print)--
  194. 56 (R)  prtPort         --struct Port *prtPort (printer port being used)--
  195. 57 (*)  charMappings    --long charMappings[4] (illegal char mappings)--
  196. 58 (D)  such            --long *such[MAXSUCH] (ptrs to config defaults)--
  197. 59 (D)  splitBufNum     --short splitBufNum[MAXSPLITS]--
  198.  
  199. 60 (R)  startSplit      --short startSplit[MAXSPLITS]--
  200. 61 (R)  stopSplit        --short stopSplit[MAXSPLITS]--
  201. 62 (R)  lineHeight      --short lineHeight[MAXLINES]--
  202. 63 (*)  coloring        --uchar coloring[3][4] (RGB colors)--
  203. 64 (*)  UNUSED          -- --
  204. 65 (*)  rc              --uchar rc[32] (page/row/col last displayed)--
  205. 66 (*)  printKeys        --uchar printKeys[ (2 * MAXPRINTABLES) + 1]--
  206. 67 (D)  bufferNames     --uchar *bufferNames[ALLBUFS]--
  207. 68 (D)  gadgetName      --uchar gadgetName[4][22]--
  208. 69 (D)  configPtr        --uchar *configPtr (name of config)--
  209.  
  210. 70 (*)  helpName        --uchar helpName[22] (name of key-help)--
  211. 71 (*)  dataName        --uchar dataName[64] (name of data file)--
  212. 72 (R)  buf             --struct CB *buf[ALLBUFS] (buffer array)--
  213. 73 (*)  n                --long n[ALLBUFS] (N-integer array)--
  214. 74 (R)  macroFunc        --function *macroFunc[MAXFCTTOKENS] (yep)--
  215. 75 (D)  oldCursorLine    --short (last cursor line)--
  216. 76 (D)  oldCursorCol    --short (last cursor col)--
  217. 77 (V)  startLine        --short (display start line)--
  218. 78 (V)  stopLine        --short (display stop line)--
  219. 79 (D)  nSplit          --short (number of split windows)--
  220.  
  221. 80 (*)  maxSaveSize     --short (max spooled file save buffer size <= 32767)--
  222. 81 (*)  altKeys         --uchar altKeys[2*MAXPRINTABLES + 1]--
  223.  
  224. (*) - could be safe to modify, if careful.
  225. (D) - dangerous to modify, but could be done if smart & careful.
  226. (R) - READ-ONLY, never use poke() on these.
  227. (V) - volatile, changing it wouldn't have any effect.
  228.  
  229.  
  230. NOTE:  On the (D) variables, by being smart and careful it is meant that it
  231. may be necessary to update several variables in order to make the change safe
  232. and workable.  A good example is nSplit and the split window arrays.  They
  233. work together and must be consistent.  Above all split 0 must never be
  234. changed, because it is curBuf.  Another example is msgQ[] and curMsgIn and
  235. curMsgOut.  These form a ring buffer and curMsgIn is normally ahead of or
  236. equal to curMsgOut.  Also the Count field in the msgQueue structure must be 0
  237. for any available input slot and non-zero (typically 1) for any unprocessed
  238. input.  Note that using these you could actually queue up inputs to the input
  239. stream.
  240.  
  241.  
  242.                             WARNINGS & Info
  243.  
  244. Here are a few selected items of info that could be helpful, plus a few
  245. selected warnings.
  246.  
  247. I can't warn you about everything or tell you under what conditions
  248. everything might or should not be modified.  Few things can be modified
  249. safely and the most innocent looking change may cause a crash, lockup, or
  250. malfunction.
  251.  
  252. For example, DO NOT change noDisplay, prints, saves, execLearn, warpUp,
  253. prtOpen, or any of the variables marked (R) in the above table.
  254.  
  255. Whatever you do, it is at your own risk:
  256.  
  257. eol:     It is probably safe to change eol, but it is not encouraged.
  258.         Changing it does NOT change the global (config default) eol value.
  259.         That one has to be changed in the such[] array.  If you do change
  260.         eol, which makes the display go screwy, use Load Data to recover from
  261.         it.  It will reset eol back to the config default eol.
  262.  
  263. horPixels & vertPixels:  Do not change these values.  Also note that 
  264.         vertPixels is the height of the window, not of the screen.  The
  265.         screen is 1 pixel taller so you can grip the screen at the top and
  266.         slide it up or down.
  267.  
  268. bufferNames: array of pointers pointing to literal strings in startup
  269.         command.  Do NOT write beyond or on top of the trailing null byte of
  270.         those strings.
  271.  
  272. gadgetName:  Keeps the name length in byte 21 of each name.  And the names
  273.         are also null terminated so the max name length is 19 bytes.
  274.  
  275. configPtr:  Points to the config name.  Do not write beyond or on top of the
  276.         trailing null byte in the config name.
  277.  
  278. printKeys:  This is the same array as in Config! defaults.  It has
  279.         two parts, each 64 bytes long.
  280.  
  281. tabTables:  You can change these tables if you enter the values in the given
  282.         table in ascending order and end with a trailing null byte.  The
  283.         lowest tab value is 1 and the highest is 255.  Unused tables should
  284.         be 0 filled.
  285.  
  286. splitBufNum: Do NOT change the buffer number of the split number stored in
  287.         curSplit - i.e., do not change the value of splitBufNum[curSplit].
  288.         It is always curBuf (curFile).  The buffer numbers of the other
  289.         splits can probably be changed, provided the buffer exists.  (I think
  290.         the display routine checks, but don't count on it.)  See the
  291.         following split window variables.  (Note:  Even if you changed the
  292.         buffer # in splitBufNum[curSplit], and changed curBuf to make it
  293.         point to the new buffer (the pointer would be in buf[n], where n is
  294.         the new buffer #), this would NOT be safe, because other steps are
  295.         required in order to switch curBuf.)
  296.  
  297. nSplit:  Do NOT change this.  This can have value 0-7, it is the # of
  298.         split windows.  curBuf (curFile) is always the curSplit position of
  299.         the arrays splitBufNum[], startSplit[], and stopSplit[].  If nSplit
  300.         is changed, the split arrays all have to be adjusted accordingly.
  301.  
  302. startSplit & stopSplit:  Do NOT change the line number values in these.
  303.         If you cause displaying beyond end of screen it would probably cause
  304.         a crash.  If you got rid of a split window without redoing the line
  305.         numbers, the displaying would be screwy and trouble might arise.
  306.  
  307. globalFlags: Do NOT set the LOCKED, READONLY, DELETEIT, or NEEDPACK flag
  308.         bits in globalFlags.  These are never set in globalFlags.  Do NOT set
  309.         or reset a buffer's flags (using buf[] or curBuf) to any of the above
  310.         values.  If the buffer is in the file-save queue, it is LOCKED and
  311.         must not be unlocked; also it may have its DELETEIT or READONLY flag
  312.         bit set.  If it is not in the queue, its LOCKED and DELETEIT flag
  313.         bits must NEVER be used.  If it is READONLY and not in the save-
  314.         queue, it cannot be put into the queue because it is read-only.  If
  315.         it is in the queue, the read-only flag is used for a certain purpose
  316.         and must not be changed.
  317.  
  318. oldCursorline & oldCursorCol:  These are used for the following purposes:
  319.         To tell the display where the cursor last was, so it can be wiped out
  320.         and moved.  In the onScreen() test.  In setRuler() and perhaps a few
  321.         other places where the cursor line might be of interest.
  322.  
  323. such:  Such[] is an array of pointers to LONG integer variables which
  324.         are the config defaults.  They appear in such[] in the same order as
  325.         they do in Config!:
  326.             
  327.         pmEsc          ([0] position)
  328.         userGlobalA    userGlobalB     columnar    cram         rowCol
  329.         markGadgets    lace            spooks       busies        teachKeys
  330.         MAXFILES       icons           searchCaps  wildCard     eitherOr
  331.         multiWild       allBut           singleWhite multiWhite    menuOffset
  332.         learnMode       cmdMultiplier   speakAlerts speakMsgs    printTabs
  333.         smartTabs       customScreen    useKeys     prefPrint    idleTime
  334.         hideDisplay    scrollType       trapMenus   sWidth        sHeight
  335.         tinyPriority   capsLock        clickTime   userGlobalC  UserGlobalD
  336.         trueTabs       autoIndent       overstrike  autoBackup    readOnly
  337.         wordWrap       rightJustify    mapChars    changed      userLocalA
  338.         userLocalB     tabTable        lineLength  splitSize    leftMargin
  339.         topMargin       bottomMargin    pageLines   eoline        inpChar
  340.         mcrNum         localColor       screenColor tinyCoords
  341.  
  342.         If you change the value of a flag, use 0 for FALSE and 1 for TRUE.
  343.         If you change a flag, its value may not be used until you open a new
  344.         buffer or maybe not even then.
  345.  
  346.         Do NOT change learnMode!  Learn has to be turned on gracefully along
  347.         with other initializing.
  348.  
  349.         localColor and screenColor are bit masks as described in the doc.
  350.         tinyCoords uses 16 bits each for the X and Y coords of the tiny
  351.         window.  If you change tinyCoords, stay safely within the pixel size
  352.         of the WorkBench window.
  353.  
  354.         If you change the value of any integer such as tabTable or eoline,
  355.         stay within the config default legal range for that variable.  These
  356.         are listed in the manual and in Config!.
  357.  
  358. macroFunc:  This is the array of pointers to the CL functions.
  359.         The functions in macroFunc[] are in the order of the function defines
  360.         below.  The first 12 functions in the function defines below don't
  361.         exist and their job is carried out in the engine itself.  Examples
  362.         are "if", "else", "return" and so on.  In macroFunc[], any function
  363.         that doesn't really exist points to Fnull() which carries out an
  364.         abort.  Also at the end of macroFunc[] may be some unused slots which
  365.         point to Fnull().
  366.  
  367. cmdTable & cmdLen:  cmdTable is the array of pointers to commands.  cmdLen
  368.         is the table of lengths of the commands.  The entries are in macroNum
  369.         order.  See the macroNum info in the manual.  If a command does not
  370.         exist, the cmdTable entry will be NULL and the cmdLen entry will be
  371.         0.  Swapping commands consists of swapping the entries of BOTH arrays
  372.         simultaneously.  NEVER put the same pointer in TWO or more entries in
  373.         cmdTable, because obviously a memory area must not be freed twice by
  374.         Uedit.  Copying a command consists of allocating a new block of
  375.         memory and copying the command into it and setting the length in
  376.         cmdLen to the same as for the command being copied.  Killing a
  377.         command consists of freeing its memory and zeroing the entries for it
  378.         in cmdTable and cmdLen.  Never change a value in cmdLen[] unless you
  379.         are swapping commands, and then the pointers in cmdTable[] must also
  380.         be swapped.  Commands are terminated by a 0 byte; the engine knows
  381.         it's finished when it hits a 0 byte that isn't part of an integer
  382.         field, that is when it is looking for the next function and instead
  383.         hits a 0.
  384.  
  385. buf & n:  These are the same as the buf and n variables in the CL.
  386.  
  387. warpUp:  If warp is not up, it can only mean one of two things:  Either
  388.         there was no memory to allocate for it or the font you are using is
  389.         not an 8 or 11 pixel font.
  390.  
  391. altKeys:  It contains both alternate keys arrays which are in the Config!
  392.         defaults.  The first is applies to the ALT key, and the second
  393.         applies to SHIFT-ALT.  The arrays are each MAXPRINTABLES in length.
  394.                     
  395.                     ***** Structures & Defines *****
  396.  
  397. #define  ALLBUFS        100
  398.  
  399. #define  MAXMENUS        7
  400. #define  MAXITEMS        20
  401. #define  MAXSUBITEMS    12
  402. #define  MAXMENUWIDTH    17
  403.  
  404. #define  MAXMACROSIZE    20480
  405. #define  MAXMACROS      1149
  406. #define  MAXFCTTOKENS     183
  407. #define  MAXMSGS     24
  408. #define  MAXLEARN     200
  409. #define  MAXWORD     132
  410. #define  MAXSTACK     10
  411. #define  MAXLINELEN  9999
  412.  
  413. #define  MAXTABS      32
  414. #define  MAXTABTABLES 5
  415. #define  MAXMARGIN    255
  416.  
  417. #define  MAXLINES       132
  418. #define  MAXLINECHARS  132
  419.  
  420. #define  MAXPRINTABLES     64
  421.  
  422. #define  BLOCKSIZE   256
  423. #define  DATASIZE     (BLOCKSIZE - 12)
  424. #define  NAMELEN     80
  425.  
  426. /* displayFlag bits */
  427. #define  SHOWCURSOR_       1
  428. #define  VSCROLL_           2
  429. #define  HSCROLL_           4
  430. #define  SHOWEOS_           8
  431. #define  PAGE_             16
  432. #define  ALLPAGE           0xfff0
  433.  
  434. #define  MAXSPLITS          8
  435.  
  436. /* execLearn flag values - DO NOT CHANGE execLearn */
  437. #define EXEC_LEARN          1    /* running learn seq */
  438. #define STOP_EXEC_LEARN     2    /* just finished running learn seq */
  439.  
  440. #define         MAXSUCH     65
  441.  
  442.  
  443. /* ------------ in CB buf-header struct, bufPtr->Flags settings --------- */
  444. #define  TRUETABS       0x0001
  445. #define  AUTOINDENT    0x0002
  446. #define  OVERSTRIKE    0x0004
  447. #define  AUTOBACKUP    0x0008
  448. #define  READONLY       0x0010
  449. #define  WORDWRAP       0x0020
  450. #define  RIGHTJUSTIFY  0x0040
  451. #define  MAPCHARS       0x0080
  452. #define  CHANGED       0x0100
  453. #define  USERLOCALA    0x0200
  454. #define  USERLOCALB    0x0400
  455. #define  FAVORITE       0x0800
  456. #define  BACKEDUP       0x1000
  457. #define  NEEDPACK       0x2000
  458. #define  LOCKED        0x4000
  459. #define  DELETEIT       0x8000
  460.  
  461. /* ----------------------- markers used in data blocks ----------------- */
  462. #define  EOFILE   0x03
  463. #define  EOB      0x02
  464. #define  TRACE    0x01                      /* to trace region to fill */
  465.  
  466. struct   msgQueue  {  /* see Amiga ROM Kernal manual */
  467.    short  Count;
  468.    ULONG  Class;
  469.    USHORT Code;
  470.    USHORT Qualifier;
  471.    short  MouseX,MouseY;
  472. };
  473.  
  474. struct ST {
  475.     long       num;  /* if buffer stack, buffer pointer stored here */
  476.     struct ST *ptr;  /* ptr to next item on the stack */
  477. };
  478.  
  479. struct DB    {  /* see manual discussion of DB struct */
  480.    UCHAR        Data[DATASIZE];
  481.    UCHAR        endOfBlock;  /* this must be EOB character */
  482.    UCHAR        eols;    /* #eols this block, 255 if formfeed or unknown */
  483.    USHORT        BlockNum; /* max buf size = 65535 * 244 = 15.99 megs */
  484.    struct DB    *LastBlock; /* pts to prev block or CB if is 1st block */
  485.    struct DB    *NextBlock; /* pts to next block or NULL if last block */
  486. };
  487.  
  488. struct CB {    /* see manual for info on CB struct */
  489.    struct DB  *Block;    /* cursor */
  490.    struct DB  *SHBlock; /* start hilite */
  491.    struct DB  *EHBlock; /* end hilite */
  492.    struct DB  *SIBlock; /* start invert */
  493.    struct DB  *EIBlock; /* end invert */
  494.    struct DB  *PBlock;  /* start page */
  495.    struct DB  *EBlock;  /* end page */
  496.    struct DB  *LABlock; /* locA */
  497.    struct DB  *LBBlock; /* etc */
  498.    struct DB  *LCBlock;
  499.    struct DB  *LDBlock;
  500.    struct DB  *LEBlock;
  501.    struct DB  *LFBlock;
  502.    struct DB  *LGBlock;
  503.    struct DB  *LHBlock;
  504.    struct DB  *LIBlock;
  505.    struct DB  *LJBlock;
  506.    struct DB  *LSPBlock; /* 2nd page beginning if file in 2 windows */
  507.    struct DB  *LSCBlock; /* 2nd cursor "" */
  508.    struct DB  *MBlock;   /* mouse loc */
  509.    UCHAR *Ptr;           /* ---- these are pointers into above blocks */
  510.    UCHAR *SHPtr;
  511.    UCHAR *EHPtr;
  512.    UCHAR *SIPtr;
  513.    UCHAR *EIPtr;
  514.    UCHAR *PPtr;
  515.    UCHAR *EPtr;
  516.    UCHAR *LAPtr;
  517.    UCHAR *LBPtr;
  518.    UCHAR *LCPtr;
  519.    UCHAR *LDPtr;
  520.    UCHAR *LEPtr;
  521.    UCHAR *LFPtr;
  522.    UCHAR *LGPtr;
  523.    UCHAR *LHPtr;
  524.    UCHAR *LIPtr;
  525.    UCHAR *LJPtr;
  526.    UCHAR *LSPPtr;
  527.    UCHAR *LSCPtr;
  528.    UCHAR *MPtr;
  529.  
  530.    struct    DB    *NextBlock;
  531.    short  PageCol;
  532.    short  BufNum;
  533.    ULONG  Flags; /* switched with Colors, and used to be USHORT */
  534.    USHORT LineLength;
  535.    USHORT PageLines;
  536.    short  tabTable;
  537.    short  LeftMargin;
  538.    short  TopMargin;
  539.    short  BottomMargin;
  540.    ULONG  Colors; /* switched with Flags, and used to be USHORT */
  541.  
  542.    long   reserved1;
  543.    long   reserved2;
  544.  
  545.    UCHAR  FileName[NAMELEN+3]; /* bumped upward */
  546. };
  547.  
  548. /* order of functions in macroFunc array */
  549. #define  abort_                 1
  550. #define  not_                    2
  551. #define  do_                    3
  552. #define  while_                 4
  553. #define  if_                    5
  554. #define  else_                  6
  555. #define  goto_                  7
  556. #define  label_                 8
  557. #define  nothing_                9
  558. #define  return_                10
  559. #define  returnTrue_            11
  560. #define  returnFalse_            12
  561. /* **** above functions do not actually exist; the following do **** */
  562. #define  mouseDown_             13
  563. #define  trackMouse_            14
  564. #define  updateDisplay_         15
  565. #define  inputWaiting_          16
  566. #define  thisKey_                17
  567. #define  abortSave_             18
  568. #define  restartPrint_          19
  569. #define  reformat_              20
  570. #define  runLearn_              21
  571. #define  fullRefresh_            22
  572. #define  refreshDisplay_        23
  573. #define  abortPrint_            24
  574.  
  575. #define  gosub_                    26
  576. #define  beepDisplay_            27
  577. #define  seeRuler_              28
  578. #define  setRuler_              29
  579.  
  580. #define  stopSpell_             32
  581. #define  spellerUp_             33
  582. #define  hyperClose_            34
  583. #define  hyperUp_                35
  584. #define  inTiny_                36
  585. #define  screenToBack_          37
  586. #define  screenToFront_         38
  587. #define  newFile_                39
  588. #define  nameBuffer_            40
  589. #define  checkedSubMenu_        41
  590. #define  menu_                  42
  591. #define  checkedMenu_            43
  592. #define  subMenu_                44
  593. #define  runKey_                45
  594. #define  gtNum_                 46
  595. #define  incNum_                47
  596. #define  decNum_                48
  597. #define  equateNum_             49
  598. #define  eqNum_                 50
  599. #define  geNum_                 51
  600. #define  and_                    52
  601. #define  or_                    53
  602. #define  mul_                    54
  603. #define  div_                    55
  604. #define  add_                    56
  605. #define  sub_                    57
  606. #define  mod_                    58
  607. #define  mouseXY_                59
  608. #define  setRGB_                60
  609. #define  isEmpty_                61
  610. #define  getSplitLines_         62
  611. #define  getChar_                63
  612. #define  onScreen_              64
  613. #define  vScroll_                65
  614. #define  hScroll_                66
  615. #define  insertRgn_             67
  616. #define  setEol_                68
  617. #define  clearRgn_              69
  618. #define  swapBuf_                70
  619. #define  print_                 71
  620. #define  loadFile_              72
  621. #define  insertFile_            73
  622. #define  alertUser_             74
  623. #define  askYesNo_              75
  624. #define  saveFile_              76
  625. #define  setFileName_            77
  626. #define  getFileName_            78
  627. #define  flipFlag_              79
  628. #define  getFlag_                80
  629. #define  toggle_                81
  630. #define  toNumber_              82
  631. #define  toWord_                83
  632. #define  toUpper_                84
  633. #define  toLower_                85
  634. #define  setLocal_              86
  635. #define  hexDecimal_            87
  636. #define  fileSize_              88
  637. #define  locToLine_             89
  638. #define  lineToLoc_             90
  639. #define  search_                91
  640. #define  saveLearn_             92
  641. #define  freeBuf_                93
  642. #define  getLocal_              94
  643. #define  is_                    95
  644. #define  loadLearn_             96
  645. #define  quit_                  97
  646. #define  printerCode_            98
  647. #define  saveConfig_            99
  648. #define  loadConfig_            100
  649. #define  moveCursor_            101
  650. #define  equateLoc_             102
  651. #define  incLoc_                103
  652. #define  decLoc_                104
  653. #define  eqLoc_                 105
  654. #define  geLoc_                 106
  655. #define  gtLoc_                 107
  656. #define  getKey_                108
  657. #define  inputKey_              109
  658. #define  swapKey_                110
  659. #define  killKey_                111
  660. #define  delay_                 112
  661. #define  editBuf_                113
  662. #define  putMsg_                114
  663. #define  inputString_            115
  664. #define  inputNum_              116
  665. #define  insertChar_            117
  666. #define  copyChar_              118
  667. #define  clearChar_             119
  668. #define  swapChar_              120
  669. #define  teachOne_              121
  670. #define  execute_                122
  671. #define  speak_                 123
  672. #define  copyColData_            124
  673. #define  clearColData_          125
  674. #define  gadgetName_            126
  675. #define  typeChar_              127
  676. #define  changeDir_             128
  677. #define  inUse_                 129
  678. #define  setMaxFiles_            130
  679. #define  getMaxFiles_            131
  680. #define  getSerialNum_          132
  681. #define  getColors_                133
  682. #define  locToIndex_            134
  683. #define  indexToLoc_            135
  684. #define  locToCol_              136
  685. #define  colToLoc_              137
  686. #define  splitWindow_            138
  687. #define  getTabs_                139
  688. #define  getPageRowCol_         140
  689. #define  gotoPage_              141
  690. #define  getKeyVal_             142
  691. #define  spell_                 143
  692. #define  startSpell_            144
  693. #define  stringComp_            145
  694. #define  rexxIn_                146
  695. #define  rexxOut_                147
  696. #define  loadKeys_              148
  697. #define  saveKeys_              149
  698. #define  push_                  150
  699. #define  pop_                    151
  700. #define  getBufAddr_            152
  701. #define  getStackSize_          153
  702. #define  rollStack_             154
  703. #define  setSearch_             155
  704. #define  attachBuf_             156
  705. #define  detachBuf_             157
  706. #define  copyKey_                158
  707. #define  gotoSplit_             159
  708. #define  getSearch_             160
  709. #define  fileRequest_            161
  710. #define  peek_                  162
  711. #define  poke_                  163
  712. #define  getAddress_            164
  713. #define  upFlag_                165
  714. #define  downFlag_              166
  715. #define  switch_                167
  716. #define  case_                  168
  717. #define  default_                169
  718. #define  text_                  170
  719. #define  swapLoc_                171
  720. #define  grep_                  172
  721. #define  setGrep_                173
  722. #define  getGrep_                174
  723. #define  setColors_             175
  724. #define  hyperOpen_             176
  725. #define  hyper_                 177
  726. #define  saveState_             178
  727. #define  loadState_             179
  728. #define  setTaskPri_            180
  729. #define  draw_                  181
  730. #define  setFont_                182
  731. #define  sortLines_             183
  732. #define  compile_                184
  733. #define  compileDefaults_        185
  734. #define  getFont_                186
  735. #define  stackBuf_              187
  736. #define  compareBuf_            188
  737. #define  define_                189
  738. #define  clearBuf_              190
  739. #define  tabsToSpaces_          191
  740. #define  spacesToTabs_          192
  741. #define  getRGB_                193
  742. #define  xor_                    194
  743. #define  fold_                  195
  744. #define  setFold_                196
  745. #define  getFold_                197
  746.  
  747.  
  748.  
  749.  
  750.                           ***** Examples *****
  751.  
  752.  
  753. <normal-esc:   .. display depth (# bitplanes)
  754.         getAddress(9,n0)
  755.         peek(n0,n1,2) putMsg(n1) >
  756.  
  757. <normal-buttonUp:    .. display mouseY
  758.         getAddress(2,n0)
  759.         peek(n0,n1,2) putMsg(n1) >
  760.  
  761. <normal-esc:   .. display maxLineChars
  762.         getAddress(10,n0)
  763.         peek(n0,n1,2) putMsg(n1) >
  764.  
  765. <normal-esc:   .. display charHeight in pixels
  766.         getAddress(11,n0)
  767.         peek(n0,n1,2) putMsg(n1) >
  768.  
  769. <normal-esc:   .. show warpUp flag
  770.         getAddress(26,n0)
  771.         peek(n0,n1,2) putMsg(n1) >
  772.  
  773. <normal-esc:   .. show curMsgIn index value
  774.         getAddress(35,n0)
  775.         peek(n0,n1,2) putMsg(n1) >
  776.  
  777. <normal-esc:   .. show ExecLearn flag
  778.         getAddress(27,n0)
  779.         peek(n0,n1,2) putMsg(n1) >
  780.  
  781. <normal-esc:   .. show horPixels
  782.         getAddress(14,n0)
  783.         peek(n0,n1,2) putMsg(n1) >
  784.  
  785. <normal-esc:   .. show vertPixels
  786.         getAddress(13,n0)
  787.         peek(n0,n1,2) putMsg(n1) >
  788.  
  789. <normal-esc:   .. show maxLines
  790.         getAddress(15,n0)
  791.         peek(n0,n1,2) putMsg(n1) >
  792.  
  793. <normal-esc:   .. show vertical pixel boundaries of text area
  794.         getAddress(62,n0)    .. get lineHeight[0] address
  795.         peek(n0,n1,2)        .. get lineHeight[0] (pixel) value
  796.         putMsg(n1)          .. pixels at bottom of msg line
  797.         delay(10)
  798.         getAddress(15,n10)  .. get maxLines address
  799.         peek(n10,n11,2)     .. get maxLines value
  800.         mul(n11,n11,2)      .. calculate lineHeight[maxLines] address offset
  801.         add(n10,n0,n11)     .. add to lineHeight[0]'s address
  802.         peek(n10,n11,2)     .. lineHeight[maxLines]
  803.         putMsg(n11) >
  804.  
  805. <normal-buttonDown:  .. mouse scrolling cmd that shows lines per pass
  806.    moveCursor(curFile,mouseLoc)
  807.    updateDisplay
  808.    mouseXY(n0,n1)
  809.    equateNum(n4,n1)
  810.    if (not mouseDown) return
  811.    while (not inputWaiting) {
  812.         trackMouse
  813.         mouseXY(n2,n3)
  814.         sub(n3,n3,n1)
  815.         div(n3,n3,5)
  816.         vscroll(n3) 
  817.         getAddress(16,n9) peek(n9,n10,2) putMsg(n10) .. vscrollamt
  818.         updateDisplay
  819.    }
  820. >
  821.  
  822. <normal-esc:   .. set toTiny flag
  823.         getAddress(23,n0)
  824.         poke(n0,1,2) putMsg(n1) >
  825.  
  826. <normal-esc:    .. change current eol to Carriage Return (NOT recommended)
  827.         getAddress(0,n0)
  828.         poke(n0,13,1) >
  829.  
  830.